package club.tclyq.good_time.upload.controller;

import club.tclyq.good_time.photowall.type.service.PhotoTypeService;
import club.tclyq.good_time.upload.bean.Photo;
import club.tclyq.good_time.upload.service.UploadImgService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import java.io.IOException;

/**
 * @author tanchong
 * Create Date: 2019/2/21
 */
@RestController
@RequestMapping("/api/v1/upload")
public class UploadImgController {

    private UploadImgService uploadImgService;


    public UploadImgController(UploadImgService uploadImgService) {
        this.uploadImgService = uploadImgService;
    }

    @PostMapping
    public void upload(@RequestParam("photoPath") MultipartFile file,
                       @RequestParam("title") String title,
                       @RequestParam("type") String  type,
                       @RequestParam("description") String description,
                       HttpServletRequest request
                       ) throws NoSuchFieldException, IOException {
      uploadImgService.uploadImg(file,title,type,description);

      // uploadImgService.uploadImgv2(file,title,type,description,request);
    }
}
